﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace E5_KhuyenMaiVang.Models
{
    public class DealManager
    {
        //
        // GET: /MemberManager/

        public static GoldDealEntities dbGoldDeal = new GoldDealEntities();

        public static void AddDeal(DealView deal)
        {
            DEAL tbDeal = new DEAL();
            tbDeal.DealID = deal.DealID;
            tbDeal.DealName = deal.DealName;
            tbDeal.Price = deal.Price;
            tbDeal.Discount = deal.Discount;
            tbDeal.StartDate = deal.StartDate;
            tbDeal.EndDate = deal.EndDate;
            tbDeal.ValidDate = deal.ValidDate;
            tbDeal.InvalidDate = deal.InvalidDate;
            tbDeal.Description = deal.Description;
            tbDeal.Image = deal.Image;
            tbDeal.Spec = deal.Spec;
            tbDeal.SoldQuantity = deal.SoldQuantity;
            tbDeal.MaxQuantity = deal.MaxQuantity;
            tbDeal.MinQuantity = deal.MinQuantity;
            tbDeal.StatusID = deal.StatusID;
            tbDeal.CompanyID = deal.CompanyID;
            tbDeal.CityID = deal.CityID;
            tbDeal.CategoryID = deal.CategoryID;

            dbGoldDeal.AddToDEAL(tbDeal);
            dbGoldDeal.SaveChanges();
        }
    }
}
